# coding: utf-8

puts "基本赋值"
x = 1
y = 2
puts x, y

puts "\n并行赋值"
x, y = y, x
puts x, y

puts "\n并行赋值的右侧支持数组"
x, y = [1, 2]
puts x, y

puts "\n这可以让方法支持返回多个结果"
def swap(x, y)
	return [y, x]
end
x, y = swap 1, 2
puts x, y

puts "\n对象属性的赋值其实是方法调用"
class TestClass
	def name
		@name
	end

	def name=(value)
		@name = value
	end
end

test = TestClass.new
test.name = "段光伟"
puts test.name
